package com.briup.app05.service.impl;

import com.briup.app05.bean.Article;
import com.briup.app05.dao.ArticleMapper;
import com.briup.app05.service.IArticleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class ArticleServiceImpl implements IArticleService {
@Resource
    private ArticleMapper articleMapper;
    @Override
    public List<Article> findAll() {
       return articleMapper.selectAll();
    }
    @Override
    public void saveOrUpdate(Article article) {
      if(article.getId()!=null){
          articleMapper.update(article);
      }
      else {
          articleMapper.insert(article);
      }
    }

    @Override
    public void delete(Long id) {
          articleMapper.delete(id);
    }
}
